import fetch from 'common/src/utils/fetch';
import baseUrl from './env';
import UTILS from "common/src/utils/utils";
import {
  param
} from 'common/src/utils';
import axios from 'axios';
const BASER_SERV_URL = '/api/baseresservice';

/**
 *  国际学术会议目录接口列表
 */

// 查询国际学术会议目录列表
function getConferenceList(data) {
  return fetch({
    url: `${baseUrl}/pgIntlConference/getConferenceList`,
    method: 'Post',
    data
  });
}
// 获取版本号
function getVersion() {
  return fetch({
    url: `${baseUrl}/pgIntlConference/getVersion`,
    method: 'get'
  });
}
// 根据学院获取一级学科
function getOneSubject(data) {
  return fetch({
    url: `${baseUrl}/pgIntlConference/getOneSubject`,
    method: 'Post',
    data
  });
}

// 新增国际会议目录
function addConference(data) {
  return fetch({
    url: `${baseUrl}/pgIntlConference/addConference`,
    method: 'Post',
    data
  });
}

// 下载导入模板
function downloadTemplate() {
  return fetch({
    url: `${baseUrl}/pgIntlConference/downloadTemplate`,
    method: 'get',
    responseType: 'blob'
  }).then(res => {
    UTILS.downloadFile(res, '导入模板.xls', 'application/vnd.ms-excel;charset=utf-8');
  });
}

// 导入国际会议目录
function importConference(data) {
  return fetch({
    url: `${baseUrl}/pgIntlConference/importConference`,
    method: 'Post',
    data
  });
}

// 删除国际会议目录
function deleteConference(data) {
  return fetch({
    url: `${baseUrl}/pgIntlConference/deleteConference`,
    method: 'Post',
    data
  });
}

// 编辑国际会议目录
function editConference(data) {
  return fetch({
    url: `${baseUrl}/pgIntlConference/editConference`,
    method: 'Post',
    data
  });
}
// 导出1
function exportExcelF(data) {
  return fetch({
    url: `${baseUrl}/pgIntlConference/exportExcel`,
    method: 'Post',
    data
  });
}

// 导出2
function exportExcelS(data) {
  return fetch({
    url: `${baseUrl}/export/result/`+data,
    method: 'get',
    data
  }) 
}

// 导出3
function exportExcelT(data) {
  return fetch({
    url: `${baseUrl}/export/file/?path=`+data,
    method: 'get',
    data,
    responseType: 'blob'
  }).then(res => {
    UTILS.downloadFile(res, '导出国际会议目录.xls', 'application/vnd.ms-excel;charset=utf-8');

  });
}
export default {
  'getConferenceList': getConferenceList,
  'getVersion': getVersion,
  'getOneSubject': getOneSubject,
  'addConference': addConference,
  'downloadTemplate': downloadTemplate,
  'importConference': importConference,
  'deleteConference': deleteConference,
  'editConference': editConference,
  'exportExcelF': exportExcelF,
  'exportExcelS': exportExcelS,
  'exportExcelT': exportExcelT

};
